public class Solution {
  
    //使用中序遍历，解决这个问题 
    TreeNode prev=null;
     public void insertTreeNode(TreeNode pCur){
        if(pCur==null){
            return;
            }
            insertTreeNode(pCur.left);
            pCur.left=prev;
            if(prev!=null){
                prev.right=pCur;
            }


            prev=pCur;//这其实相当于打印出了结点


            //System.out.println(pCur.val+"");
            insertTreeNode(pCur.right);
     }
      
    public TreeNode Convert(TreeNode pRootOfTree) {
       insertTreeNode(pRootOfTree);
       //返回双向链表的头结点
    TreeNode head=pRootOfTree;
    while(head!=null&&head.left!=null){
        head=head.left;
    }
       return head;
    }
    
}
